import cv2 as cv

gray_img = cv.imread("../data/sudoku.png",0)

x = cv.Sobel(gray_img,cv.CV_16S,1,0)
y = cv.Sobel(gray_img,cv.CV_16S,0,1)

Scale_absX = cv.convertScaleAbs(x)
Scale_absY = cv.convertScaleAbs(y)
result = cv.addWeighted(Scale_absX, 0.5, Scale_absY, 0.5, 0)

cv.imshow('img',gray_img)
cv.imshow('Scale_absX',Scale_absX)
cv.imshow('Scale_absY',Scale_absY)
cv.imshow('result',result)
cv.waitKey(0)
cv.destroyAllWindows()